import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('firesRoot')
export class firesRoot extends Component {
    @property(Prefab) fire:Prefab
    start() {
        this.createfire();
    }
    createfire()
    {
            const fire = instantiate(this.fire);
            const x = Math.random() * 1100 - 550
            const y = fire.getPosition().y
            fire.setPosition(x,y)
            this.node.addChild(fire);
        this.schedule(()=>
        {
            const fire = instantiate(this.fire);
            const x = Math.random() * 1100 - 550
            const y = fire.getPosition().y
            fire.setPosition(x,y)
            this.node.addChild(fire);
        },0.5)
    }
    update(deltaTime: number) {
        
    }
}


